Mandelbrot sample refactorings and performance improvements