remove switch, use function pointers to call methods