Refactor: Extract fn