If the book of Ezra is all about the rebuilding of the Temple, the book of Nehemiah is all about the rebuilding of the walls of Jerusalem.
Nehemiah, like the book of Ezra, is told in the first person. Nehemiah is a royal cup-bearer for the king of Persia, who asks permission (much like Ezra) to go back to his homeland to check things out. He's heard the walls surrounding the city have fallen to ruin and when he gets there it turns out the rumours are true. The king gives Nehemiah an armed escort to go on the journey back to Jerusalem and also funds to rebuild the walls.
The people are organized into families who are told to work on the section of the wall closest to thier homes. They're motivated to work hard because the wall means protection from enemies. The catch-22 is, however, that once they start rebuilding the walls, their enemies (the Samaritans and others) assume the Jews are planning to rebel, and so they try to attack the Jews while they build. The Jews therefore build, "with one of his hands wrought in the work, and with the other hand held a weapon." -- Nehemiah 4:17
Having your enemies trying to attack you while you fortify your city is probably motivation enough to get on with it in a hurry, and they finish rebuilding the wall around Jerusalem in just 52 days. So they're happy and have a party, but then...
When Ezra reads the Law of Moses (the Torah?) to his people, who have forgotten, the people feel terrible and mourn the loss of their history and connection to God and then profess their sins and re-dedicate themselves to the Lord. All is well, except...
There are again foreigners in their midst. And Nehemiah, like Ezra, makes sure to drive them all away in order to ensure the inhabitants of Jerusalem are all descendents of Abraham, Isaac and Jacob (Isreal) and not of any other nation. I'm guessing the reason for the purification of the Jewish community at that time was to keep the Jewish teachings from becoming diluted with outside traditions and culture.
Though why foreigners who married into the Jewish community couldn't simply have been converted, I still don't undertand. Regardless, I suppose you've got to admire them for their continual attempts to get back to being good, despite the many times they lose their way on the path. The Jews in the Old Testament are always inclined to get back on the horse, no matter how many times they fall off.