edited code for new motor board