moved data off scope
Fix legend