* Added option to specify error handing function