Fix stupid reconnection issue once and for all, update constant names, add some comments