refactor getting data