Remove debug and unused code