Unique generation is used instead of arbitrary constants.

Also some documentation and exports.
Fixed GHC warnings.