Try to avoid unnecessary nesting by returning a value early

Try to avoid unnecessary nesting by returning a value early

Too much nesting & else statements tend to make code harder to read.