Fix #53 - Refactor rsync

This is mostly a style cleanup, but I also was able to simplify a number of code paths, eliminate duplicate code, and fix a few bugs. I've also renamed a bunch of variables to make it more clear what's happening, broken things into smaller functions, and re-ordered some operations so the nesting isn't so deep.
this might fail if options.checksum is set as null