added function as parameter