Code reshaped according to Python PEPs.