More streamlining and use of python idioms.