use early returns to simplify and de-nest