Cleaned up code and formatting.