Creating and using user-defined functions