Refactoring and cutting fix