minor memory optimizations - dont store so much in q matrix