Alexander Cumming patented the first flush toilet in 1775, incorporating an S-trap to prevent sewer gases from entering the building. Modern toilets still incorporate this design feature.