Updated function to take multiple arguments