Bunch of bug fixes and updated docs