renamed ptopdepth to potdepth2 as variable with same name already exists