slide animationand refactor