Cleaning up some code and added Debug Mode