Updated lib with better url encoding