split out functions for readability