WIP, most api calls implemented and exposed to CLI.