Switched from pointer incrementing to indexing for memory