better logic for image/video display