used legend feature and used updated samples