Cleaned everything up, less imperative, soon to be unthreaded