Wrote proper index