please add a comment why passing `endpoint` around is needed