Only a few weird edge cases failing. The rest works well now.