Added callback function, closed #1