Implemented assignment 4