Moved logic to add locality in else block.