Best label is found for each Literal (Each literal has multiple labels)
And made some minor changes to the code