refactored fibonacci iterating code