Another major rewrite. Many parts already working.