Add separate validation and munging actions.

Munging is intended for text-oriented inputs (like CLI, HTTP).
Update to new validation mechanism on attributes

Also add more comments documenting parts of code.