been a while.. neat use of TH to simplify gen_foo methods