refactored indices_of coordinates method