Lots of cleanups, fixed lint errors, beautified code