Adding error messaging for type mismatches