adding rebuildBase function