set states as constants, cleanup code a bit, detect possible bug.
make code a bit easier to read
add missing semicolon (very recent perl verisoning fail here)
Merge pull request #4 from stdweird/VM_states

VM states