some refactoring (CPU state moved to separated class)