Logic cleanup

Able to overwrite original jpeg image after rotation now.