Use block scope to limit access of auxiliary functions

- Clean up the duplicate variable x
Tail recursive factorial