improved url detection, thanks DrJest
added some commentst