Refactored rest endpoints