@markusweimer  @shravanmn Apparently, 'then' and 'else' blocks above contain identical code. Is that right?
P.S. I am merging the two blocks into one - please correct me if this is not the right thing to do.