Utility functions split out from main tasks