image optimization closes #85 and also closes #167