Made more pythonic