Move state stuff to Coils framework