improve paint all method