Tail recursion optimization
Removed old tests