Add end document to every generated file in any case.
Some clarifications to README.
Started test case calling perl. Moved functions shared between test cases to a common header file.