Preparations for code refactoring and improvements