Clean up code, fix pull request compilation errors.