Use tail recursion instead of atoms. More explanatory naming.