added jpg save (needs work)