This is an abomination. Surely there is a better way.