Got rid of recursion in sub device opening.