refactored service; added ajax call