Extracted function for readability