Removed duplicated line in docstring
Typo & PEP8 fixes
Fixed code according to comment

Not 100% sure of this fix, but it seems sensible and the test passes.
PEP8 and a minor code simplification
Better check suggested in code review
Merge pull request #1253 from delallea/minor

Minor fixes