Improved style/consistency

Also added an object for storing CPU state.
Added support for XML file writing