now refactored to manage endpoints just like queries