Added function checkValidUrl.

Added function, global and local vars and if statement.
Added returns.
Added return value output to console.