add canvas handler, change to requirejs, restructure