added support for multi-commands, some tidy up, fixed bug in test server