I see this line a lot. Casting from byte to a state vertex and vice versa. This should be a method.