added database functions, and many new api calls