adding image handling code