Committing really well working code that seems potentially faster and more
compact than my "optimized" branch