Modification of Zachary Denton's whatbetter script.