Moved variable to input parsing (were it belongs), covered corner / reachability cases with state booleans