new kernel function, and improve data io