Add option to plot beam contours on images, and clean up memory