Changed the method of callback handling to something more extensible