Refactor block label logic