Cleaned up some debug code and removed commented code that is no longer used