Updated function definition