re-organize the code of dataset