Added label generation logic