updated to include the additional checks
modified function to allow urls