refactor for the new REST response format