Removed unneeded libraries, fixed bugs with tmpstring