Made some graphics optimizations and an optimization in LinCogRandom