added a future test reminder that I need tail call optimization
slight refactoring
added tail call optimization