Merge server and fsm into a single library
Integrate fsm