definition of buildUrl function to encourage DRY.
Merge pull request #5 from mazzi/master

definition of buildUrl function to encourage DRY.