change location of functions to common.js