Function handling was too clever by half.
Christ, I have no idea what I'm doing anymore.