Start of rewrite as a more documented and practical system