working on async issue refactoring to promises