updated getData() to be self-sufficient