nits
implements saving state
adds misc. control logic