added max clients constant and checking for that
added generics checking
fixed channel subscription
added recursive close channels calls for clean up after a client left