consolidate the common code, and share the common code