More common getData function