Python 3, couple optimizations