(master) added ability for custom function to be specified