added logic for setting labels