improved scripts for import and querying