re organise server prototype