defining and running functions