Code for the programming assignment 2 updated