Cleaned up refactored code. Removed warnings.