added code for better repainting on book load