Added SO_REUSEADDR to the socket flags so it will restart immediately after shutting down instead of waiting TIME_WAIT for the connections to clear. Also cleaned up shutdown process