Almost done with cpu functions