implementing whole function type checking