Added new functionality for the motor demo