Add some docstrings, fix bugs I thought I'd fixed before