Improved framerate calculation