refactored getData()