redid other functions to handle data as dictionary