Changes to the printing
Added check of state to variables