Remove yucky nested ifs and explicit returns