Check length before proceeding with the run function