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