add the fixes from class discussion