Added check for invalid BMPs.
OS X compile fix.
Added more docs.