added currentFrame calculation.