Updates to improve viewer drawing speed

Several bug fixes and removed the requirement to draw the image twice
on refresh.