Unsubscribe from topic

Currently the wrong id is being sent when you unsubscribe from a topic and the channel remains open.

   + Consistent line endings and some code re-factoring in the second commit
I think this is an editor artifact I didn't mean to touch this line