Lint and clean-up the code.

@cfjedimaster, please take a look when you have time. Some linting and clean up.