Merge pull request #7 from andrepl/master

register join/leave commands
fixed a few more bugs