refactored the factory code to make all the data real-time