Adapted to seperate server and client structure.