Fix indexing and some id assignment/pref name stuff.
little touches.