move common functions to a common file

Authored by jriddell on Jul 31 2019, 2:09 PM.