Formalized state validation

When I modify the struct's layout in the future, it becomes much easier