add legend to refactor demo
change function name of refactor demo