Cleanup a lot of code