Rewrite vm.

Now it is more useful.