added code for Scenario1_binary and Scenario 3