Assignment2B finished with the help of Siddharth