Did some cleaning up and attemped to profile the code.