Improved printing of long strings.
Also fixed some bugs and added some TODOs.