refactor code, return readable stream data