Added urlescape function and renamed curl variable