Uniformize code and more comments