Yeah, the resulting code is certainly a bit opaque. :/