code cleanup and improved error reporting
Merge pull request #9 from SuperstarDonkeyJockey/image-check

code cleanup and improved error reporting