refactor figure