-added state based switching (preparing to incorporate menu)