Added more callbacks. Fixed segmentation faults.