Shared code update and cleanup