Refactored the code: splitted C code by modules, implemented Json messaging as C++ classes.