cleaner code for one-server solution