First attempt on making it work on CPU side