Refactor auto resize code
Removed scrollTo dependency