refactored REST api