Cleaning up some code and tweaking some settings