refactoring data processing and cleansing