iteration 2 completed. Need more refactoring.