Is there any documentation on how refinement works? What are create-state-update and apply-state-update intended for?