I thought about that but I wanted the array to persist throughout the life of the script. Otherwise it would be doing a lot of calls to that. Or, if you did it that way, you would most likely have to put it early in the execution of the script which might mean more queries than necessary.

I do agree that $context is a bad variable because it should be used to pass from controller to view, but if you moved it, you'd need a lot  of code duplication and that code duplication would need to be done in the models anyway.