fixed syncspecfiles so it will also keep other variables. Moved common methods into new module