finish putting common functions into separate files