Extracted common code