This code is view-specific, so I'm not wildly excited about putting it here in a general tools module.