added legend to templates