fixed some syntax errors, refactoring seems to work. datadir added