Added timer to limit framerate.