changed implementation of getdata into promise pattern, yet to understand fully