server scripts rewritten nicely