Added code to be able to simulate protocol. Fixed logging function signatures.
Added two mains. Added more comments. Fixed radio and sim bugs.