added legend, calcindex tests