slightly prettier output code
pass self reference to all functions so they can recurse