Added manual control

and refactoring a little