rewrote the entire js file
organized api
made apis private, added functions for user api