refactor where urls are passed into functions