removed condition in if statement by first removing element from dictionary