Improved documentation and fixed examples