Clean up, documentation and memory usage improvement of tab "Share" code