I have wasted so much time on this commit writing bad code which I eventually eliminated... (sigh)