Further refactoring of extraction and labelling