how societies function