Refactoring of rsync functions.

    Get rid of using global variables