more tweaks to peek function