Run code once, wait x minutes then run code 5 times.

This time I'm facing another problem. Let's say I have a motor and encoder. Full turn takes " X" pulses. I want to turn motor for 10 pulses, then stop it, wait 20 minutes, then turn in again 5 times, every time only for X/5 pulses. Each Pause between each turn should be 2 times shorter from the previous pause. After 5th turn motor should stop and 'be ready' to turn in other direction. Any help is appreciated.

You need a state machine.
http://www.thebox.myzen.co.uk/Tutorial/State_Machine.html