DEV: Pythonic improvements to code as per Tom's comments