Preparing surrounding code for scrolling function rewrite