refactoring and asyncronous retrieval from db