Refactor cpu