Updated Engine class to extend Canvas and updated MainCanvas class accordingly.

Check the code comments for more detailed info.