Major code refactoring part 13.