add split function and modify interface to foreach.