Improved if checks