Lint and clean-up the code.

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