Refactored stuff, added index metric adapters.