done some improvements to make it works well with MeshNet. The code still need to be cleaned and documented