basic lib functions and some server fun-ness