ScoredMatrix class is not working-need a different approach