Added categorise mode code