refactor fibonacci to functional fibonacci