Updated Secure and Unsecure Functions

I made all the suggested changes except that I didn't add similar
site_url functions.  Overall I think the improvement is pretty dramatic.