changed animations to use length instead of end index