refactor function syntax