refactor completeAction to use type-class pattern