Added structs for callbacks and a few minor changes.