pulled out some functions for importing