Mahmud smashed the infidels ' idols and destroyed their temples as he went , but was nonetheless cultured enough to use the booty to build a library , a museum , and a splendid mosque when he got back to Ghazni .
In addition , Mahmud also erected a large marble monument in the city of Ghazni .