working on server mode