Moved the URL encoding function to a utils file