Implementation using function pointers