centralized expression logic; fixed warning in endpoint creation