Fixed plot auto algorithms and

also made some performance improvements