New protocol and some important fixes

- Added Old REV switches support (thanks to @easy12)
- The GC library and thread library have been slightly
changed to be thread safe again.
- In the receive thread, the sleep has been replaced by
thread safe mutexes and conditions.
- Fixed bug in node mode. Received codes from nodes
were not processed correctly.