1. fixed the bug in the Spread function. 2. add compare and OnehotAndIndex function 3. optimize the code