reconnect less agressively over time
prepared some stuff for eventual python3 port (far from complete yet)