Improve share function