Implement functionality for lab5