Improvements to capability negotiation
Merge pull request #19 from maxanton/capability-negotiation-fixes

Improvements to capability negotiation