Remove recursion in VM