refactor code. data sharing