Escape url & refactor client