recursive factorial changed to iterative