Some more refactoring of cpu implementation