API call refactoring, ability to run API call synchronously