update API endpoints and return types, refactoring