Argh! This is getting really complicated... will try to sketch another impl like we discussed,