suspect we can shorten this class a lot with some meta-programming.