Moved common motor code to dedicated class