Refactored ajax service to only expose its private methods for unit tests