Significant refactor to try to eliminate flicker in Safari/Mozilla. (partially complete)