Implemented the motion of the target + some changes of the code