updated the function definition