Fixed up some image processing stuff, edited some tests