Docs and more robust code