Refactor cpu count