made changes to make server.js suck less

Note I said suck less this thing is going to need a lot more help to not
be so crappy.