Fixed bug + cleaned up source code

Fixed a bug that prevented the canvas from showing its last row and
cleaned up the source code