added non recursive mode