Clean up remaining 'any'-typed loaders.
More 'any' removal.
That import was creating an undefined variable reference, oops.

Not sure if it was my fault or the compiler's...
Index the monitor dictionaries by the monitor ref value.

Original code was using the object itself, which (if things work
correctly) resulted in the object's string representation being the key.
This added unnecessary overhead because toString() got invoked
repeatedly.

However, it also hid a number of bugs where the monitor object was
actually null or undefined. This commit fixes those bugs as well.