full server overhaul

I add almost all the functionality not sure if it works