
I added these return statements so that invalid inputs or valid end cases would no longer continue running through the rest of the function.
I added these return statements so that invalid inputs or valid end cases would no longer continue running through the rest of the function.