Improved readability; added STL use