Added cpustate-function and tested it