converted to postgresql and reworked the url-validating code