Codechange: Added just-in-time arrays

These arrays are allocated once written to instead of on creation. This should reduce memory usage as AI will not write to all arrays.