Refactor default value assignment into func