Code for homework