remove more globals, refactoring related code
new config file