Made Python module more pythonic