Fixed formatting issues and added animationDuration as parameter