Code is nice now, and a bug with canvas rendering on the inactive tabs is fixed.