Added auto reconnect
Fixed bug that would cause build errors, added delay before reconnect