working code for milestone 3