Updated solution for Prog Assignment 2