I think its ok now. Change "lot size" and "lot step" according to your taste, compile and test it.
You are welcome. Is it ok ?