Got while loop working