Added image output code