pull common functions out of gmux