i -> idx

improved impl
solved conflict