Implementation 2: add exchange kernel function