This is a little confusing - perhaps the time variable should be renamed to frame to avoid the confusion?