Do early returns instead of global ifs to reduce code churn