Added some code which gets the full URL and the p variable from the URL