Refactor: Fix many bugs and be more idiomatic
Reject repeated urls. Also remove trailing slash