replaced escape with encodeURIComponent functions to handle &