refactoring the details extraction