more tweaks to functions