refactor simple type checking