remove canvas and context from global scope
restructure functions
refactor example