split code into states