Trimming param names on validation and on import

Trim parameter names before applying, and on import, to avoid
duplication.
(Also added minor style change for an if statement)