Simplify and cleanup event and dom modules, add context option to main constructor