added functions, made returned data into json