Added stage generation agorithm and copying of position
Merge