Command handling and initial threading/locking for callback handling.