Modified Assignment 8 according to the requirements