some refactoring, added dest option and recursive dir creation