Code for deliverable 2