Extracted common functions