bad version of index using pointers -.-