refactoring. Painter interface was added