Cleaning up debugging and unused code