Big reordering of server part.