Replaced UIImage with CGImage where it made sense.