replaced metaprogramming with Map