add functionality as specified in the assignment