Split share function into a file