Many Kudos go to Segher Boessenkool and Patrick Georgi for figuring this one