for-each-ref: rename some functions and make them public