Refactoring getting data