added vertical scrolling logic