Dilute hydrochloric acid was added to substance X. There was a vigorous action and a gas was produced which turned limewater milky. After the reaction stopped, an excess of aqueous sodium hydroxide was added to the solution and a blue precipitate formed. What was X?