Moved template out of script and into template file. Added guard against services with a regex. Moved constants to top of script. Got rid of j.mp which is covered by longurl.org