added grid class and MainRandom for wondering