Fix errors in outside three-pixel bounding box calculations.

Also addresses: PEP8 Formatting. Pylint warnings. Removes redundant parenthesis. Spelling.