Adding a thread ID per thread
library is built correctly even if rf_options.h is missing
Big code refactoring

- First of all note to self: never ever break the build so bad that a refactoring will take
  so long as to need 1 month to get fixed in the limited free time I have.

- With this commit the error logging system has been revamped as mentioned in issue #13.
  The return chain has also changed quite a lot for many functions but could still use work.
  The error logging system now logs much more information and has only one log file.

- The test system has also been improved for issue #12. The logfile of each test is also printed
  if and only if there has been anything logged. And each test also now has acceptable logging
  lines. If any of the logfiles are not in the acceptable ones then the test fails.

- The commit is also addressing several other minor things here and there.