back to a working state; also now correctly removing deleted files
Some refactoring in prep for multiple Client support; should be no functional changes