Painter algorithm and some code restyle