Simplify recursive/not recursive logic