restored most of the lost code (thank goodness)