Implemented Painter, added saving image to main loop