Slightly Simplified Code from M. Bostock's Object Constancy Example

Source of original: http://bost.ocks.org/mike/constancy/