Add support for string output and improve print function. Split test files.