a boatload of metaprogramming and reorg