Added device type.
Fixed dead-locking/segfaulting.
Revamped callback handling.
Moved types around, fixed bug in cb toggling.