code refactoring and implemented configuration file