Fixed errors with loaded states where legend data was not corrupted;
Refactored legend API to pass model instead of index