refactor smart scroll