Move dict processing into else statement