Add wrapper functions to compare images
Large change; now have basic optimization framework