update documentation examples, fix code so they actually work