updated: more tail calls