Halfway decoupled a small core that interacts with the DOM so that it's easier to implement Web Workers later.