add config file and refacing code