removing While loop