split commands into functions on clientside, soon to do same to serverside.

Signed-off-by: Miethop <miethpomail@yahoo.co.uk>