Cleaned up code and turned on profiling