add unit test. Update the logical of the create server functions