Second commit of total server-side rework. not done.