VM states

this is branched from #3, so that one has to be merged in first.

This is also a cool change, because it reduces the code alot.

Thanks :+1: