Added more doctests and longer descriptions.
Merge with updates from PALP normal form and clean up.