Fix a bunch of todos, add some docs