fixed serious memory leak and increased grid size by 1.5x