made user defined functions work