Add sphinx docs, tests, fix bugs, integrate frontend