Cleaned the code in preparation for pull request.