Task 2 implemented but returning wrong values