motor code added: untested