Cleaned up Eclipse warnings and refactored some code.