added global state, began implementing server internals