Improved debugging information and checked code with cppcheck for potential memory leaks or style errors. Also permanently fixed the problem of improper closure of the module, by which even though Simulink wouldn't crash after several runs, conflicts among yarp ports could happen because reentrancy was not handled properly during termination. This was due to the fact that the counter variable that controls reentrancy was not being set back to zero after the simulation stopped. Stopping a simulation in Simulink doesn't imply reloading of the mex library, thus static variables keep their last values