Cleaned up string code a bit, using c++ class