Added validation and tweaked the import