removing while loop