More pythonic code and pep-8