Removed the redundant variable 'totalLevels'