refactored async rest and test