Big rewrite. Many changes.