expects a function as last arg