Basically just added `KeyError` and moved everything past the potential offending lines into an `else:`