Reduce CPU time

This handles the check more efficiently.