Code reduction via metaprogramming