Bunch of code simplifications and formatting fixes
Factorize close control and data socket into Router::closeSockets
Improve comments + fix some minor code formatting