fixed a missing docstring, added code to save images to file.