remove that while loop, opt for recursive instead