Refactor to add unit test

1. Change the url making part in Form1 to a new function
2. Unit test that function.