fixed url collision check, tidied up the server code a little