Stop using recursion in the conversion of states to/from their corresponding indices.