consolidated cpu code to cpu.py