Added return if the check is successful, skips unnecessary code execution.