adds server mode
created tests for server mode