modified widget to use callback functions