new code for motor. not working yet