Rename CursorCommand => CursorState
Neater foreach syntax