Tests added, documentation and examples improved.