Clean up and remove a bunch of unnecessary code