Import: fix process, use functions and insert on duplicate.