Applied cleaned up refreshImage from Eric.