refactor JpegSegments stuff into own file