Model states & generate id