accept jpg or JPG as extension of image files
move toward removing JPG as an explicit token parsing sentinel
move inner classes out