added more code to the Mid term