Fix layout and prettify the python code