Fixed to work with names

fixed to work with names rather than indexes