arm movement  and refactored code