Cleaning up undefined and length usage in the code.
Renamed save to share. Fixed bug introduced in code cleanup.