refactor opening draw plugin