check for non-existing shade + various optimizations