Assignment2 code