Removed some unused code
Fixed compiler warning about unused debug variable