corrected remaining calculation