implemented type checking