Rewrite key import function