FIX: test return code in startsess

FIX: move all functions out of the client class
FIX: remove all unused functions/methods except getReplicasNew()
FIX: ban has_key() and x in l.keys(), remove sortList usage