made more pythonic