Revert "trying to fix the wrapping issue"

This reverts commit cbaa1f88cc2164de9b685fa3d58adf380fec4c40.
revert changes in scroll function