Removed redundant pattern match at bottom of translate.
Rewrote a bunch of image parsing functions.