Task 2 implemented and tested