Pythonify idiomatic changes

my attempt to pythonify the code a little bit