Handle lists more pythonically