updated version of non recursive