Reworked server logic