refactor function signature