Added code for assignments 4 to 6