Removed unnecessary files from repository, refactored URL building

It's generally considered bad practice to commit binaries, user-specific config files, or other generated files.  Commit fd60298 fixes this by adding a gitignore file.  Also, nested if/else control structures are brittle and harder to read.  I've refactored the URL building into a function which should facilitate maintenance and ease readability.