Integrated merge script into the main script calls and added switches for selecting operating modes