Optimization for checking for known types