Removing dead code and invalid messages.