Cleaned up some metaprogramming