refactor function args