Task 3 with tests