Rewrite

Removed complicated choice when destination file exists. Replace file is
now the default behaviour unless --import option is used.

Lots of code refactoring.