Correct remove graph function by encapsulating in named div