use continuation-passing style