implement more complete type checking;