added code needed for plotimage