add configure file, trap mod + optimize the structure of the script