added server functionality and tests