Add min score; reformat code