These two if loops do exactly the same thing to different urls. A separate method here?