updated motor code