working code for Milestone 2