Cleaned up and formatted code.