enabled trws to support varying number of labels and fixed bugs in testing suite