shifting to array approach, index is broken right now