The multiple roles of a dispersant in nanocomposite systems