Refactor to add saving, clearing& count