Brutal brutal brutal puzzle, but the relief I felt finishing it was incredible. There's probably some minor optimizations somewhere, but I'm close enough to a local min that I'm happy to not improve on it