refactor function params