refactor figures