(refactor) Updated to use FromFn