reworked core and windowmanager to be immutable and return the new state. this makes for easier chaining of calls