Server now functional. Also added removing sockets when connection lost.