Implemented some speedups for plotting