ENH: Replaced double indexing as it causes python overhead