reformat config JSON object for easier dev customization, refactor some codes