#9: Mostly cleanup/refactor, but does start to integrate promises and window global.