added more config options, refactoring