System code refactoring