vm: Add some more features. Reorganize a bit.