A lot of general cleanup