Creating a grid of Objects using nested while loops