Cleaned it up a bit; now PEP8 ok, kudos to Alex Pilon for enhancements and recommendations.