Clean up source code

Pull request to merge clean-up-source-code with master.