refactor text label code