Final working code for the deliverable