Refactoring before working on data streaming