update code docs, templates; reorder `State` methods