Move collapse_row() to module-level function, correct scoring inaccuracy.