More elegant dictionary updates

Thanks @wasade!