Fixed an insecurity that allowed a sync to make changes to the outside filesystem. Refactored directory structure and variables.