Refactoring preprocessing