Fixed solution for problem 10. Using generic type for return value.