Removed debugger, and refactored a bit