Added state saving. Made all necessary classes implement Serializable to
accomplish this.