Version 0.4.2: added a callback function