Refactored some code. Got rid of some debug code.