move view all out of while loop