Extract setLabel function