Fix logic.
Fix raw handling, clean up states.