refactoring code using now async