Implement simple long polling
Change from mutable state to state machine