refactored tidy factory and data