removed index method due to possible race conditions
added indexing method