Adapted Code to work for new amount of motors