Updated some code to use the STL