change startup order, separate state and server setup