Bug fixes and protocol improvements