made header functions tail recursive
added real web server