Moved logic to build the list of labels to the initialization phase of the program