Return from the function as early as possible
This reduces the depth of the if statements and improves clarity of the code