Added separate checkURL function for parsing URL