Refactor demo endpoint