simplified code that runs for all scenarios