Moved some helper functions from WebServer to Util.