Refactor to shrink code and add factory function to create the mandelbrot set object.