properly handle passing functions