refactoring sw_matrix out of the score, improving overlap logic