removed functions. added while loop.