Changed approach to commands + repaired closing connection on client exit