refactor hunchentoot utils, taken from the paster app