Fixed an issue with getting indexes from keys. Other minor bug fixes and clean ups.
Changed some variable names to improve clarity. Fixed loaders to use keys instead of indexes