Updated VM lookup code, should be much faster in larger environments