This function is used in two modules and should be pushed down into base.js