changed variable isFlagged to static in Square class