added callback functions, tests and documentation