Updated VM lookup code, should be much faster in larger environments + remove duplicate line