Remove a lot of unused code