Updated docs and fixed a bug