Remove globals, and update events to use internal bus rather than window