Added task 6 implementation