Cleanup and additions to General Functions