Pythonic improvements