Asynchronous State Machine

Fixes #47 
Fixes #52