refactor on filestream