Correct implementation of share function.