Removed a lot of global state