[Refactoring] Fixed compiler warnings/cleaned up some code.