Small pythonic rewites & optim

This PR must be tested properly, so I'm sending it into travis.