final refactoring after the accomplishment of the pos machine