improve the way we use rest endpoints