moved cpu logic into separate method