Refactoring system. Part I