Cleaned up code and prepared for code review.