Support passing function as argument