Cleanup: Remove "using namespace std;" and add constness to searches.

Also new instead of malloc.