Safenames parser.

Implements #384