consolidate some functions