changed variable names keys->positions