got rid of the stupid global state, it ruins everything