Final Assignment2 code