Reorganize scripts.
Get validation to work within directive.