removed a memcpy in place of indexing