Updates fn to account for scrolling