Quick refactoring to improve performances