added docs and fixed example