Added 'safe' dict pop. Check if the value exists.
if it exists return dict.pop else return none