using typeid for dispatching instead of a stupid macro