fixed branching logic to account for line numbers starting at 0, not 1