Implemented lab5.