Server side fixes + restructuring/improvements