extracted function for readability