Improved documentation. Reordered declaration and exports for exposition.