Implemented type checking for Task 1