added support for user defined pre callbacks