Optimized to use single array