Changed helperfunctions to smartlegend